/******************************************************************************
Class:MyGame
Implements:GameEntity
Author:Rich Davison	<richard.davison4@newcastle.ac.uk>, Callum Rhodes <c.g.rhodes@ncl.ac.uk> and YOU!
Description: This is an example of a derived game class - all of your game
specific things will go here. Such things would include setting up the game
environment (level, enemies, pickups, whatever), and keeping track of what the
gameplay state is (Is the player dead? Has he/she won the game? And so on).

To get you started, there's a few static functions included that will create
create some simple game objects - ideally your game object loading would be
handled by config files or somesuch, but for a simple demo game, these
functions are a good start. Don't be afraid to modify/delete/add more of these!

Finally, there's some calls to the OGLRenderer debug draw functions that have
been added to the course this year. These are really useful for debugging the
state of your game in a graphical way - i.e drawing a line from a character
to the item it is aiming at, or pointing in the direction it is moving, or
for drawing debug bounding volumes to see when objects collide. Feel free
to add more of these debug functions - how they are implemented is covered
in the code definitions for them, and also in the extra introduction
document on the research website.

Have fun!


-_-_-_-_-_-_-_,------,
_-_-_-_-_-_-_-|   /\_/\   NYANYANYAN
-_-_-_-_-_-_-~|__( ^ .^) /
_-_-_-_-_-_-_-""  ""

*//////////////////////////////////////////////////////////////////////////////



#pragma once
#include "GameEntity.h"
#include "GameClass.h"
#include "GameSound.h"
#include "../nclgl/CubeRobot.h"
#include "Spawner.h"
#include "AIController.h"
#include "PlayerCLass.h"
#include "TerrainClass.h"
#include "TerrainGenerationData.h"
#include "PlayerDataNetworking.h"

#define FOG_SPAWN_TIME 4000
#define CHECK_SPAWN_TIME -900

class MyGame : public GameClass	{
public:
	MyGame(bool multiplayer = false, TerrainGenerationData* tGData = NULL);
	~MyGame(void);

	virtual void UpdateGame(float msec);

	// ------------------------ Added by Monica ----------------------------- //
	void setTerrainGenerationData(TerrainGenerationData* tdata);
	static bool UPDATE_SERVER;
	static bool UPDATE_TERRAIN_DATA;

	PlayerDataNetworking* getPlayerDataNetworking() const { return pDNet; }
	// -------------------------------------------------------------------- //

protected:
	GameEntity* BuildCubeEntity(float size, Vector3 angvel, Vector3 linvel, Vector3 position, Vector4 colour, float invmass);
	GameEntity* BuildSphereEntity(float radius, Vector3 pos, Vector3 vel);
	GameEntity* BuildQuadEntity(float size);

	AIController* controller;
	Spawner*	objectSpawner;

	float gameTimer;
	float buffSpawnTimer;
	float debuffSpawnTimer;

	Mesh* cube;

	// -------- Added by Monica ---------------- //
	TerrainClass* terrain;
	PlayerClass* player;

	TerrainGenerationData* tGData;
	PlayerDataNetworking* pDNet;

	bool debug;

	vector<PhysicsNode*> spawnedObjectsPhysicsNodes;
	vector<int> spawnedObjectsIds;

	int getIndexOfElementFromSpawnedObjectsIds(int id);
	void setLinearVelocityOfSpawnedObjects(Vector3 velocity);

	void restartSpawnObject();
	int getIdInAllEntities(int id);
	// ---------------------------------------- //

	//added by Matrix
	float fotSpawnTimer;
	float checkPointTimer;

};

